home *** CD-ROM | disk | FTP | other *** search
/ Gekkan Dennou Club 145 / Gekkan Dennou Club - 2000.6 Vol. 145 (Japan).7z / Gekkan Dennou Club - 2000.6 Vol. 145 (Japan) (Track 1).bin / games / spassion / knowhow.lzh / ノウハウ / キョリケイサン.bas < prev    next >
BASIC Source File  |  1993-11-08  |  2KB  |  89 lines

  1. int i
  2. int x,y
  3. int tx=128:ty=128
  4. int cir(63)
  5. float fx,fy
  6. float f,dat
  7. /*---------------
  8. screen 0,2,1,1
  9. /*#############[ アークタンジェント テ-ブル make ]#################
  10. for i=0 to 63
  11.   fx=abs(i-32):fy=-32
  12.   if fx<>0 then  {
  13.     dat=atan(fx/fy)
  14.     f=65536/cos(dat)
  15.     cir(i)=f
  16.   } else {
  17.     cir(i)=65536
  18.   }
  19. next
  20. /*
  21. /*
  22. /*#############[ ジッコウサンプル ]###########################
  23. print "インチキ キョリケイサン"
  24. for x=0 to 255
  25.   for y=0 to 255
  26.     pset(x,y,kyori(x-tx,y-ty)and 255)
  27.   next
  28.   if inkey$(0)<>"" then end
  29. next
  30. /*-------------
  31. print "sqrカンスウ キョリケイサン"
  32. for x=0 to 255
  33.   for y=0 to 255
  34.     pset(x,y,int(sqr((x-tx)*(x-tx)+(y-ty)*(y-ty)))+16)
  35.   next
  36.   if inkey$(0)<>"" then end
  37. next
  38. /*-------------
  39. print "hit any key"
  40. while inkey$(0)="":endwhile
  41. /*#######################################################
  42. /*
  43. /* きょり きんじけいさん
  44. /*
  45. /* (x1,x2)ト(x2,y2)トノキョリハ、kyori(x1-x2,y1-y2)デモトマル。
  46. /* モドリチ = キョリ
  47. /*-------------------------------------------------------
  48. func kyori(x,y)
  49. int a,l,abs_x,abs_y
  50. /*
  51. if x=0 then x=1
  52. if y=0 then y=1
  53. if x>0 then abs_x=x else abs_x=-x
  54. if y>0 then abs_y=y else abs_y=-y
  55. if abs_x>abs_y then {
  56.   if x>0 then {
  57.     if y>0 then {
  58.       a=&h40 + ((y shl 5)+(abs_x shr 1))/abs_x
  59.     } else {
  60.       a=&h40 + ((y shl 5)-(abs_x shr 1))/abs_x
  61.     }
  62.   } else {
  63.     if y>0 then {
  64.       a=&hC0 - ((y shl 5)+(abs_x shr 1))/abs_x
  65.     } else {
  66.       a=&hC0 - ((y shl 5)-(abs_x shr 1))/abs_x
  67.     }
  68.   }
  69.   l=abs_x*cir(a+32 and 63) shr 16
  70. } else {
  71.   if y>0 then {
  72.     if x>0 then {
  73.       a=&h80 - ((x shl 5)+(abs_y shr 1))/abs_y
  74.     } else {
  75.       a=&h80 - ((x shl 5)-(abs_y shr 1))/abs_y
  76.     }
  77.   } else {
  78.     if x>0 then {
  79.       a=       ((x shl 5)+(abs_y shr 1))/abs_y
  80.     } else {
  81.       a=       ((x shl 5)-(abs_y shr 1))/abs_y
  82.     }
  83.   }
  84.   l=abs_y*cir(a+32 and 63) shr 16
  85. }
  86. /*ーーーーーーーーーーーーーーーーー
  87. return(l)
  88. endfunc
  89.